Auto connect OpenVPN
· One min read
> Version 2.5
Ref: Configuring OpenVPN to run automatically on system startup
- Put
.ovpn
config file in folder%ProgramFiles%\OpenVPN\config-auto\
- Set OpenVPNService service to Automatic
Using PowerShell
Administrator PowerShell
$action = New-ScheduledTaskAction -Execute "`"${env:ProgramFiles}\OpenVPN\bin\openvpn.exe`"" -Argument "--config `"${env:UserProfile}\OpenVPN\config\OpenVPN.ovpn`""
$principal = New-ScheduledTaskPrincipal -UserId SYSTEM
$trigger = New-ScheduledTaskTrigger -AtLogOn
$task = New-ScheduledTask -Action $action -Principal $principal -Trigger $trigger
Register-ScheduledTask -TaskName OpenVPN -InputObject $task
Using GUI
Start Task Scheduler
Create Task
Change User or Group to SYSTEM
Trigger ▶ New
Begin the task ▶ At log on
Actions ▶ New
- Set Program to
"%ProgramFiles%\OpenVPN\bin\openvpn.exe"
- Set Arg to
--config "<OpenVPN.ovpn path>"